#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int N, M;
	scanf("%d %d", &N, &M);
	int u[10] = { 0 };
	int v[10] = { 0 };
	int d[10] = { 0 };
	int i = 0;
	int counts = 0;
	for (i = 0; i < M; i++)
	{
		scanf("%d %d", &u[i], &v[i]);
		d[u[i]]++;
		d[v[i]]++;
	}
	for(i = 0; i <M; i++)
	{
		counts += (d[u[i]] - 1) * (d[v[i]] - 1) * 2;
	}
	printf("%d\n", counts);



	return 0;
}